using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PACKETPARSERMAX20.CORE;

namespace PACKETPARSERMAX20.CORE.DEFINITIONS
{
    public class CMSG_MOVE_KNOCK_BACK_ACK_DEF : DefinitionBase
    {

        public override bool Process()
        {
            ResetPosition();

            var movementInfo = new MovementInfo();

            if (ClientBuild >= 10314)
            {
                movementInfo.guid = popGuid();
 
            }
            else
            {
                movementInfo.guid = ReadUInt64();
            }


            var sequence = ReadUInt32();

            movementInfo.movementFlags = (MovementFlags)ReadUInt32();

            movementInfo.timeStamp = ReadUInt32();

            if (ClientBuild >= 9183)
            {
                movementInfo.movementFlags2 = (MovementFlags2)ReadUInt16();
            }
            else
            {
                movementInfo.movementFlags2 = (MovementFlags2)ReadByte();
            }

            movementInfo.positionInfo = ReadCoord4();

            UInt32 ukn1 = ReadUInt32();

            float vspeed = ReadSingle();
            float xdirection = ReadSingle();
            float ydirection = ReadSingle();
            float hspeed = ReadSingle();
             
            UpdateObjectPosition(movementInfo);

            //Warning = "CMSG_MOVE_KNOCK_BACK_ACK";

            //System.IO.StreamWriter sww = new System.IO.StreamWriter("found.log", true);
            //sww.WriteLine(string.Format("{0}\t{1}\t{2}", "CMSG_MOVE_KNOCK_BACK_ACK", base.context.Reader.CurrentIndex, context.Reader.FileName));
            //sww.Close();

            return Validate();
        }
    }
}

